//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//

//
#ifndef Green_AddressFilteringRegulatorGPGPU_H
#define Green_AddressFilteringRegulatorGPGPU_H

#include "AddressFilteringRegulator.h"

namespace Green {

  /*!
    \class AddressFilteringRegulatorGPGPU
    \brief GPGPU layer class regulating GenPageRequest object before passing it to Paging system.
  */
  class AddressFilteringRegulatorGPGPU : public AddressFilteringRegulator {
  public:
    Object* Clone() const override;  //!< Return a cloned object of the same type and same contents of the AddressFilteringRegulatorGPGPU object.
    const char* Type() const override { return "AddressFilteringRegulatorGPGPU"; } //!< Return a string describing the actual type of the AddressFilteringRegulatorGPGPU object

    AddressFilteringRegulatorGPGPU(); //!< Default constructor.
    ~AddressFilteringRegulatorGPGPU(); //!< Destructor.

    void Setup(const Generator* pGen) override; //!< Setup the AddressFilteringRegulatorGPGPU object.
  protected:
    AddressFilteringRegulatorGPGPU(const AddressFilteringRegulatorGPGPU& rOther); //!< Copy constructor.
    ASSIGNMENT_OPERATOR_ABSENT(AddressFilteringRegulatorGPGPU);
    void GetInstrVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints) const override; //!< Return necessary VmConstraint objects for instruction access in GPGPU layer.
    void GetDataVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints) const override; //!< Return necessary VmConstraint objects for data access in GPGPU layer.
    void GetInstrAccessVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints, EExceptionConstraintType permConstrType ) const; //!< Handle instruction permission related VM constraints.
    void GetInstrPageFaultVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints, EExceptionConstraintType permConstrType ) const; //!< Handle instruction page fault related VM constraints.
    void GetDataAccessVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints, EExceptionConstraintType permConstrType) const; //!< Handle data permission related VM constraints.
    void GetDataPageFaultVmConstraints(const GenPageRequest& rPageReq, const VmMapper& rVmMapper, std::vector<VmConstraint* >& rVmConstraints, EExceptionConstraintType permConstrType) const; //!< Handle data page fault related VM constraints.
  protected:
   };

}

#endif //Green_AddressFilteringRegulatorGPGPU_H
